package pattern.singleton;

/**
 * <b>【双重检查所- Double Checked Locking】【推荐】</b><br>
 * Lazy Loading: 是 <br>
 * 线程安全: 是 <br>
 *
 * @Author: wangxiaonan
 * @Date: 2019/3/11
 **/
public class Singleton6 {

    // 一定要加volatile修饰
    private static volatile Singleton6 INSTANCE;

    private Singleton6() {
    }

    public static Singleton6 getInstance() {
        if (INSTANCE == null) {
            synchronized (Singleton6.class) {
                if (INSTANCE == null) {
                    INSTANCE = new Singleton6();
                }
            }
        }
        return INSTANCE;
    }

}
